Skip to main content

All Questions

1vote
1answer
44views

Trying to create a shortcode that displays taxonomy terms in a dropdown

I have a snippet that displays all terms from specified taxonomy in a drop down menu. The code works perfectly when it's hardcoded but I am struggling to get it to work as a custom shortcode. The ...
user1048696's user avatar
0votes
1answer
577views

correct way to enqueue js and css files for wordpress shortcode?

I have created a php class file. I am enqueuing the required CSS and JS files in the class's constructor. public function __construct() { add_action('wp_enqueue_scripts', array($this, '...
SDeveloperj's user avatar
1vote
0answers
475views

Wordpress load same script two times

I write a basic plugin with custom css/js. I use wp_enqueue_script for my custom script and use hook 'init' to register script in front-end page. But wordpress load this javascript file two times with ...
tecnico57's user avatar
0votes
1answer
557views

wp_enqueue_scripts does not work on admin page

I'm trying to create a slider shortcode with Slick Slider and for some reason it does not work in the admin page in the page builder and I'm getting this error: I already enqueue it in my functions....
leonardeveloper's user avatar
0votes
1answer
793views

How to make my shortcode load scripts and styles, from within the plugin?

This sounds like a silly problem, but I was searching for an answer, and couldn't find anything. And the things that I did find, I tried and didn't work or were very vague. Content My Problem What I ...
Mähnenwolf's user avatar
1vote
0answers
385views

How to force that styles are enqueued in the header?

I have a plugin processing a shortcode, that needs specific styles. For this I used wp_enqueue_style. As I just need to enqueue the CSS upon certain parameters of the shortcode, I call ...
humhum's user avatar
0votes
1answer
128views

enqueue script with get_shortcode_regex

I try to optimize a bit and i want to load some shortcodes only if they are found in global $post Unfortunately its not working, the script is not loaded when i open a page which contains the ...
LovinQuaQua's user avatar
2votes
1answer
89views

Can't get JS code to work with shortcode

I am trying to create a plugin and I've got stuck. I am trying to register and enqueue a script from a shortcode: This is my shortcode: add_shortcode( 'gear-guide', 'gg_product_front_end' ); This is ...
Omer's user avatar
  • 149
1vote
0answers
24views

Making sure that a plugin's scripts and stylesheets are included for dynamicaly loaded content

I'm currently making a theme that uses admin-ajax.php to dynamicaly load pages and posts. Some of this content uses plugins like final tiles gallery and Video Embed & Thumbnail Generator. If ...
Aymeric Bianco pelle's user avatar
0votes
2answers
2kviews

Adding JS in header when using wp_enqueue_script in a shortcode

I'm trying to enqueue a JavaScript file in the header of my website. If I add the following in my main plugin file the JS is included in the header: function wpdocs_theme_name_scripts() { ...
The Bobster's user avatar
0votes
2answers
1kviews

Why am I unable to load scripts in head in plugin?

I have registered scripts which are supposed to load in head section. But for some reason I don't get these links loaded in head. Instead of loading scripts in head these are loading in footer. ...
Pravin Work's user avatar
1vote
1answer
308views

Pass $this to function nested in another public function of the same class

I'm building a plugin using the WordPress Plugin Boilerplate by DevinVinson. I'm adding a public shortcode function for wich I will need some resources (js and css), I want to enqueue scripts (that ...
bluantinoo's user avatar
4votes
2answers
5kviews

Enqueue script only when shortcode is used, with WP Plugin Boilerplate

I'm building a plugin using the WordPress Plugin Boilerplate by DevinVinson. Everything works fine, except one thing: I'm trying to enqueue scripts and css only when a shortcode is present in the ...
bluantinoo's user avatar
0votes
1answer
201views

Deactivate JS Script in Plugin Shortcode

I am using a plugin which enqueues a javascript file in one of its shortcode functions (which I run on a page). I don't want this file to be loaded. So I tried using wp_dequeue_script in my ...
theyuv's user avatar
0votes
1answer
7kviews

Create shortcode to echo javascript

I have this typed.js code snippet, which I want to call from a shortcode: <script src="https://www.example.com/wp-content/themes/mediso-v1-03/javascript/jquery-2.2.4.min.js"></script> <...
File_Submit's user avatar

153050per page
close